package com.hrserviceserve.dao;

import com.hrserviceserve.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

@Transactional
public interface UserRepository extends JpaRepository<User,Integer> {
    User findByUsernameAndPassword(String username,String password);

    int deleteByUsername(String username);

    User findByUsername(String username);

    @Modifying
    @Query("update User set avatar=?2 where username=?1")
    int upava(String name,String ava);
    @Modifying
    @Query("update User set password=?2 where username=?1")
    int uppwd(String a,String b);
}
